﻿
IF object_id(N'dbo.[UDS_Staff_In_Position]', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[UDS_Staff_In_Position] (
        [Staff_ID]    int NOT NULL,
        [Position_ID] int NOT NULL,
    
        CONSTRAINT [PK_UDS_Staff_In_Position] PRIMARY KEY (Staff_ID asc),
        CONSTRAINT [FK_UDS_Staff_In_Position_Staff_ID] FOREIGN KEY (Staff_ID) REFERENCES dbo.UDS_Staff (Staff_ID),
        CONSTRAINT [FK_UDS_Staff_In_Position_Position_ID] FOREIGN KEY (Position_ID) REFERENCES dbo.UDS_Position (Position_ID)
    );
END
GO

SET NOCOUNT ON;
IF NOT EXISTS (SELECT 1 FROM dbo.[UDS_Staff_In_Position])
BEGIN
    INSERT INTO dbo.UDS_Staff_In_Position (Staff_ID, Position_ID) VALUES(1, 4);
END
GO